home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 105_01 / floatsum.c < prev    next >
Encoding:
Text File  |  1984-06-03  |  1.0 KB  |  38 lines

  1.  
  2. /* 
  3.     This program is a simple example of how to use
  4.     Bob Mathias's floating point package. To compile it,
  5.     first compile (but do not link) both this file
  6.     and FLOAT.C.
  7.     Then, give the CLINK command:
  8.  
  9.     A>clink floatsum float <cr>
  10.  
  11.     and run the thing by saying:
  12.  
  13.     A>floatsum
  14.  
  15.     Note: the "printf" function resulting from this linkage
  16.     will support the "e" and "f" floating point conversion
  17.     characters, but the regular "printf" would not. The reason:
  18.     the special version of "_spr" in the FLOAT.C source file
  19.     takes precedence over the library version of "_spr", and
  20.     thus supports the extra features. See the comments in FLOAT.C
  21.     for more details on this strangeness.
  22. */
  23.  
  24. main()
  25. {
  26.     char s1[5], s2[5];
  27.     char string[30];
  28.     char sb[30];
  29.     int i;
  30.     atof(s1,"0");
  31.     while (1) {
  32.         printf("sum = %10.6f\n",s1);
  33.         printf("\nEnter a floating number: ");
  34.         fpadd(s1,s1,atof(s2,gets(string)));
  35.     }
  36. }
  37.  
  38.